{ "cells": [ { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "application/javascript": [ "\n", " var component = document.getElementById(\"sketch_4\");\n", " if (component != undefined)\n", " component.remove();\n", " component = document.getElementById(\"state_4\");\n", " if (component != undefined)\n", " component.remove();\n", " component = document.getElementById(\"controls_div_4\");\n", " if (component != undefined)\n", " component.remove();\n", " require([window.location.protocol + \"//calysto.github.io/javascripts/processing/processing.js\"], function() {\n", " // FIXME: Stop all previously running versions (?)\n", " var processingInstance = Processing.getInstanceById(\"canvas_4\");\n", " if (processingInstance != undefined && processingInstance.isRunning())\n", " processingInstance.noLoop();\n", " });\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " Sketch #4:
\n", "
\n", "
\n", "
\n", " \n", " \n", " \n", " \n", "
\n", "Sketch #4 state: Loading...
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "void setup() {\n", " size(500, 500);\n", "}\n", "\n", "float mystery3(int x1, int y1, float length, float angle) { // LINE 5\n", " return x1 + length * cos(angle);\n", "}\n", "\n", "float mystery4(int x1, int y1, float length, float angle) { // LINE 9\n", " return y1 - length * sin(angle);\n", "}\n", "\n", "float mystery5(int x1, int y1, float x2, float y2) { // LINE 13\n", " return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));\n", "}\n", "\n", "void draw() {\n", " int cx = width/2;\n", " int cy = height/2;\n", " int length = width/2 * 3/4;\n", " float x = cx + length;\n", " float y = cy;\n", " for (float angle = 0; angle < 2 * PI; angle = angle + PI/50) {\n", " line(cx, cy, x, y);\n", " float ox = x; // last x\n", " float oy = y; // last y\n", " x = mystery3(cx, cy, mystery5(cx, cy, ox, oy), angle); // LINE 27\n", " y = mystery4(cx, cy, mystery5(cx, cy, ox, oy), angle);\n", " }\n", "}\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Calysto Processing", "language": "java", "name": "calysto_processing" }, "language_info": { "codemirror_mode": { "name": "text/x-java", "version": 2 }, "file_extension": ".java", "mimetype": "text/x-java", "name": "java" } }, "nbformat": 4, "nbformat_minor": 0 }